//
//  NetTool.h
//  Jyxt
//
//  Created by 刘日 on 17/5/25.
//  Copyright © 2017年 DaLian Rental Housing Management. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface NetTool : NSObject

/**
 请求成功的回调block
 
 @param response 请求成功的服务器返回数据
 */
typedef void (^ REQUEST_SUCCESS)(NSDictionary *response);
/**
 请求失败的回调block
 
 @param error 请求失败的异常信息
 */
typedef void (^ REQUEST_ERROR)(NSError *error);

/**
 Get请求
 
 @param url 要请求的url
 @param data 请求的数据对象
 @param onSuccess 请求成功的回调block
 @param onError 请求失败的回调block
 */
+ (void)getWithUrl: (NSString *)url data: (NSObject *)data onSuccess: (REQUEST_SUCCESS)onSuccess onError: (REQUEST_ERROR)onError;

/**
 Post请求
 
 @param url 要请求的url
 @param data 请求的数据对象
 @param onSuccess 请求成功的回调block
 @param onError 请求失败的回调block
 */
+ (void)postWithUrl: (NSString *)url data: (NSObject *)data onSuccess: (REQUEST_SUCCESS)onSuccess onError: (REQUEST_ERROR)onError;

/**
 postiamgeQingqiu

 @param url 要请求的url
 @param data 请求的数据对象
 @param onSuccess 请求成功的回调block
 @param onError 请求失败的回调block
 */
+ (void)postImageWithUrl: (NSString *)url data: (NSObject *)data onSuccess: (REQUEST_SUCCESS)onSuccess onError: (REQUEST_ERROR)onError;

+ (void)uploadWithUrl: (NSString *)url parameters:(NSObject *)parameters data: (NSDictionary<NSString *, UIImage *> *)data onSuccess: (REQUEST_SUCCESS)onSuccess onError: (REQUEST_ERROR)onError;


@end
